Important notes on field timestamps

UTC format

All timestamps received in the Python block are UTC timestamps.

If you want to set output field timestamps, remember to create the timestamps with the correct time zone information.

UTC timestamps are created as follows:

timestamp = datetime.datetime(year, month, day, hour, minute, second, microsecond, tzinfo=datetime.timezone.utc)

Upper and lower bounds

Timestamps for input fields and output fields are bounded.

Input fields

Input field timestamps are bounded in the following ways.

  • Minimum

    • The minimum value of a timestamp read from an input field is 1970/1/1 00:00:00.

    • If the actual timestamp of the field is less than the minimum value, the value available to the Python script is changed to the minimum value.

  • Maximum

    • The maximum value of a timestamp read from an input field is 3000/1/1 00:00:00.

    • If the actual timestamp of the field is more than this maximum value, the value available to the Python script is changed to the maximum value.

Output fields

Output field timestamps are bounded in the following ways. These need to be taken into account when setting output field timestamps in your script.

  • Minimum

    • The initial timestamp of an output field is set to a minimum value of 1601/1/1 00:00:00.

    • If you set the output field timestamp to any value less than this minimum value, the output field’s timestamp is changed to the minimum value.

  • Previous timestamp

    • An output field timestamp may never be less than the previous timestamp of that output field.

    • If you set the output field timestamp to any value less than the previous timestamp, script execution fails.

  • Execute time

    • An output field timestamp may never be larger than the execute time (now()).

    • If you set the output field timestamp to any value greater than now(), script execution fails.

  • Change or lack of change

    • If the value or quality of an output field changes between executes, so must the timestamp for that field.

    • If the value or quality of an output field changes but the timestamp does not change, script execution fails.

 


Related topics:

  

CSense 2023- Last updated: June 24,2025